package com.example.controller;

import com.example.dto.MessageDto;
import com.example.service.ClientService;
import com.example.utils.IDUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class TestController {

    @Resource
    private ClientService clientService;

    @RequestMapping("send")
    public MessageDto send() {
        MessageDto messageDto = new MessageDto(IDUtils.getId());
        clientService.getIoSession().write(messageDto);
        return messageDto;
    }
}
